package com.prs.crm.domain.cqunicom;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;

/**
 * @author WangTing
 * 
 * 创建时间：2011-3-4
 */


 /////////////////////////////服务类别
 

@Entity
@Table(name="cq_services_type")
public class ServicesType extends BaseEntity{
	
	private static final long serialVersionUID = 1L;
	
	@Id@GeneratedValue(strategy=GenerationType.IDENTITY)
	
	private Integer id;
	
	private String name;
	
	/**
	 *
	 * 服务名称
	 */
	
	@OneToMany(mappedBy = "servicesType")
	@Cascade({ org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<Services> details;
	
	
	public void addDetail(Services detail) {
		if (details == null)
			details = new HashSet<Services>();
		detail.setServicesType(this);
		details.add(detail);
	}
	
	public Set<Services> getDetails() {
		return details;
	}
	public void setDetails(Set<Services> details) {
		this.details = details;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	
}
